﻿using AutoMapper.Internal.Mappers;
using ERP.Common.Results;
using ERP.ERPSystem.HumanResources;
using ERP.ERPSystem.HumanResources.Dto.InterviewMenagementI;
using ERP.Team.HumanResources;
using ERP.Team.RBAC;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ERP.Web.Controllers.HumanResources
{
    public class InterviewMenagementController : Controller
    {
        //面试管理服务接口
        InterviewMenagementIServices _interviewMenagementIServices;


        public InterviewMenagementController(InterviewMenagementIServices interviewMenagementIServices)
        {
            _interviewMenagementIServices = interviewMenagementIServices;
        }

        public IActionResult InterviewMenagementQuery()
        {
            return View();
        }

        /// <summary>
        /// 面试面试信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<InterviewMenagementIDto>> GetInterviewMenagementDept()
        {
            var InterviewMenagementModel = await _interviewMenagementIServices.GetInterviewMenagementDept();
            return InterviewMenagementModel.ToList();

        }
        /// <summary>
        /// 面试面试信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<InterviewMenagementModel>> GetInterviewMenagementModel(int page = 1, int limit = 3)
        {
            var InterviewMenagementModel = await _interviewMenagementIServices.GetInterviewMenagementModel(page, limit);
            return InterviewMenagementModel;
        }
        
        /// <summary>
        /// 获取带部门信息的面试管理信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<InterviewMenagementIDto>> GetInterviewMenagementModelWithDepartment()
        {
            var result = await _interviewMenagementIServices.GetInterviewMenagementDept();
            return result;
        }
        
        /// <summary>
        /// 新增面试管理信息
        /// </summary>
        /// <param name="interviewMenagementIDto"></param>
        /// <returns></returns>
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<int> AddInterviewMenagement(InterviewMenagementIDto interviewMenagementIDto)
        {
            var i = await _interviewMenagementIServices.AddInterviewMenagement(interviewMenagementIDto);
            return i;
        }
        /// <summary>
        /// 获取部门信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<DepartmentModel>> GetDepartmentModel()
        {
            var i = await _interviewMenagementIServices.GetDepartmentModel();
            return i;
        }
        /// <summary>
        /// 反馈面试管理信息
        /// </summary>
        /// <param name="feedbackInterviewMenagementDto"></param>
        /// <returns></returns>
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<int> UpdateInterviewMenagement(FeedbackInterviewMenagementDto feedbackInterviewMenagementDto)
        {
            var i = await _interviewMenagementIServices.UpdateInterviewMenagement(feedbackInterviewMenagementDto);
            return i;
        }
        /// <summary>
        /// 删除面试管理信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<int> DeleleteInterviewMenagement(int id)
        {
            var i = await _interviewMenagementIServices.DeleleteInterviewMenagement(id);
            return i;
        }
    }
}
